
let user = {
    name: "施佳晨",
    age: 18,
}
//创建之后我们观察它
observer(user)
// 姓
function getFirstName() {
    let firstNameDom = document.getElementById("firstname")
    firstNameDom.innerHTML = user.name.slice(0, 1)
}
// 名
function getLastName() {
    let lastNameDom = document.getElementById("lastname")
    lastNameDom.innerHTML = user.name.slice(1)
}
// 年纪
function getAge() {
    let ageDom = document.getElementById("age")
    ageDom.innerHTML = user.age
}
//参数，功能，返回值，调用时机
// window._sjc
/*
拿到依赖项 ---> window.__scj = getFirstName
执行依赖项 ---> getFirstName()
删除依赖  --> delete window.__scj/__scj = null

*/
autorun(getFirstName)
autorun(getLastName)
// autorun(getAge)